<?php

class reply_m extends MY_Model {

    protected $_table_name = 'tbl_replies';
    protected $_primary_key = 'rep_id';
    protected $_primary_filter = 'intval';
    protected $_order_by = '';

    public function __construct() {
        parent::__construct();
    }

    // pagination 
    public function record_count($id) {
        $this->db->where('thread_id', $id);
        $this->db->from($this->_table_name);
        return $this->db->count_all();
    }

    public function fetch_reply($limit, $start) {
        $this->db->limit($limit, $start);
        $query = $this->db->get();

        if ($query->num_rows() > 0) {
            foreach ($query->result() as $row) {
                $data[] = $row;
            }
            return $data;
        }
        return false;
    }

}